package vg.services.graph_view_manager.realization.graph_view.smart_graph_view.realization;

import java.util.Map;

import vg.services.graph_view_manager.interfaces.graph_view.IGraphSettings;
import vg.services.graph_view_manager.realization.graph_view.smart_graph_view.interfaces.ISGVGraphView4Patching;
import vg.services.graph_view_manager.realization.graph_view.smart_graph_view.interfaces.ISGVPatchManager;
import vg.services.graph_view_manager.realization.graph_view.smart_graph_view.realization.patches.DefaultPatch;

/**
 * Implementation of IGraphSettings.
 * @author Timur Zolotuhin (e-mail: tzolotuhin@gmail.com)
 */
public class SGVGraphSettings implements IGraphSettings {
	// Main components
	private ISGVPatchManager sgv_patch_manager;

	
	public SGVGraphSettings(ISGVPatchManager sgv_patch_manager) {
		this.sgv_patch_manager = sgv_patch_manager;
	}
	
	@Override
	public void setStyle(final String style, final Object value) {
		DefaultPatch patch = new DefaultPatch("setStyle") {
			@Override
			public void apply(ISGVGraphView4Patching graphView4patching) {
				graphView4patching.setStyle(style, value);
			}
		};
		
		sgv_patch_manager.addPatch(patch);		
	}
	
	@Override
	public void setStyle(final Map<String, Object> stylesheet) {
		DefaultPatch patch = new DefaultPatch("map setStyle") {
			@Override
			public void apply(ISGVGraphView4Patching graphView4patching) {
				graphView4patching.setStyle(stylesheet);
			}
		};
		
		sgv_patch_manager.addPatch(patch);				
	}
}
